package wms.api.core.mybatis.utils;

import wms.api.core.mybatis.bean.PagerBean;
import com.github.pagehelper.Page;

/**
 * Created by fisher4u on 2017/11/24.
 */
@SuppressWarnings("unchecked")
public class PagerUtils {
	/**
	 * 获得pager
	 *
	 * @return
	 */
	public static <T> Object getPager(Page<T> page) {
		if (page.getReasonable() == null) {
			return page;
		}

		PagerBean pagerBean = new PagerBean();
		pagerBean.setData(page);
		pagerBean.setTotal(page.getTotal());
		return pagerBean;
	}
}
